<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>数组</title>
</head>

<body>
    <p></p>
    <script>
        // function repeat(n, str) {
        //     return (new Array(n + 1)).join(str);
        // }
        // console.log(repeat(3, 'hello')); // "hellohellohello"
        // console.log(['a', 'b'].join('hello')) // "ahellob"

        // var arr = [1, 2, 3, 4, 5, 6];
        var arr = [1, 2, 3, 4, 5, 6];
        console.log(arr.some(function (item, index, array) {
            console.log('item=' + item + ',index=' + index + ',array=' + array);
            return item > 3;
        }));

        console.log(arr.every(function (item, index, array) {
            console.log('item=' + item + ',index=' + index + ',array=' + array);
            return item > 3;
        }));
        // let array = new Array(n + 2);
        // array = array.join('-1,').split(',');
        // array.length = n + 1;
    </script>
</body>

</html>